<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>会员中心</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
    <script src="js/ajax.js"></script>
</head>
<body>
<div id="app" >

    <div v-if="eqs.length==0">暂无数据</div>
    <div v-else>
        <div v-for="e in eqs" style="padding:10px;margin:10px;font-size:14px;">
            <div>设备名称：{{e.name}}</div>
            <div>设备类型：{{e.equipmentType.typeName}}</div>
            <div>设备图片
            <br />
                <img v-for="p in e.equipmentPics"
                     :src="p.url" width="30%" style="margin:10px;" />
            </div>
            <div>设备录入日期:{{e.createdate}}</div>
            <div>设备编号:{{e.eNo}}</div>
            <div>报修二维码<br />
                <img
                     :src="'http://java59.hfbdqn.cn/findimg?fileName='+e.barCode" width="30%" />
            </div>
            <div>
                <button class="weui-btn weui-btn_mini weui-btn_primary">删除</button>
                <button class="weui-btn weui-btn_mini weui-btn_primary">报修</button>
                <button class="weui-btn weui-btn_mini weui-btn_primary">查看详情</button>
                <button class="weui-btn weui-btn_mini weui-btn_primary">查看报修历史</button>
            </div>
        </div>
        <div style="text-align:center;padding:20px;">{{ loadingtxt}}</div>
        <hr />
    </div>
</div>

<!-- body 最后 -->
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>

<!-- 如果使用了某些拓展插件还需要额外的JS -->
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/swiper.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/city-picker.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="js/jssdk.js"></script>

<script>
    var v = new Vue({
        el: "#app",
        data: {
            p:1,
            eqs:[],
            loadingtxt:'拼命加载中...'
        }
    });


       // v.bxm.openid = openid;
//?user_openid:'oSLehju0XHzjg5j49BegEd4bNWQs'
        loadData(v.p);
        function loadData(p){
            if(v.loadingtxt=="我也是有底线的"){
                return ;
            }

            $.showLoading("正在加载...");
            $.get("/find_baoxiuman_byopenid", {openid: localStorage.openid}, function (data) {
                $.hideLoading();
                if (data) {
                    $.get("/findall_eq_by_baoxiuman?openid="+ localStorage.openid+"&p="+p+"&size=3",null,function(data){
                      //  v.eqs = data.content;
                        if(data.content.length==0){
                            v.loadingtxt = "我也是有底线的"
                            return;
                        }

                        v.eqs = v.eqs.concat(data.content);
                    })
                }else{
                    location = 'baoxiuman_add.html';
                }
            });
        }


    window.onscroll = function(){
        var ch = document.documentElement.clientHeight||document.body.clientHeight;
        var sh = document.documentElement.scrollHeight||document.body.scrollHeight;
        var st=  document.documentElement.scrollTop||document.body.scrollTop;
        //console.log(Math.ceil(ch+st)+" "+ Math.ceil(sh))
        if(Math.abs(ch+st-sh)<1){
            v.p++;
            loadData(v.p);
        }
    }
</script>

</body>
</html>